package com.antaohua.framework.web.utils;

import java.io.Serializable;

public class JsonResult
  implements Serializable
{
  private static final long serialVersionUID = -5217887050447614829L;
   public static final Boolean STATUS_SUCCESS = true;

   public static final Boolean STATUS_ERROR = false;
   
   
   private Object data;
   private Boolean success = Boolean.valueOf(true);
   private String errorMessage;

  public JsonResult()
  {
  }

  public JsonResult(Boolean success, Object data, String errorMessage)
  {
     this.data = data;
     this.success = success;
     this.errorMessage = errorMessage;
  }

  public JsonResult(Boolean success) {
     this.success = success;
     if (success.equals(STATUS_SUCCESS))
       this.errorMessage = "成功";
     else if (success.equals(STATUS_ERROR))
       this.errorMessage = "失败";
  }

  public JsonResult(Boolean success, String errorMessage)
  {
     this.success = success;
     this.errorMessage = errorMessage;
  }

  public JsonResult(Boolean success, Object data) {
     this.data = data;
     this.success = success;
     if (success.equals(STATUS_SUCCESS))
       this.errorMessage = "成功";
     else if (success.equals(STATUS_ERROR))
       this.errorMessage = "失败";
  }

  public Object getData()
  {
     return this.data;
  }

  public void setData(Object data)
  {
     this.data = data;
  }

  public Boolean getSuccess()
  {
     return this.success;
  }

  public void setSuccess(Boolean success)
  {
     this.success = success;
  }

  public String getErrorMessage()
  {
     return this.errorMessage;
  }

  public void setErrorMessage(String errorMessage)
  {
     this.errorMessage = errorMessage;
  }
}
